package day7;

import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;

public class TestMap {
    public static void main(String[] args) {
        Map<String,Integer> map=new HashMap<>();
        //不允许key和value 为null
        //默认11  new对象初始化11 0.75 2n+1
        //线程安全(方法添加了同步锁 )  效率比较低
        Map<String,Integer> map2=new Hashtable<>();
        map.put(null,100);
        map.put("java",null);
        map.put(null,null);
        //迭代器遍历
        Iterator<Map.Entry<String,Integer>> it=
                map.entrySet().iterator();
        while(it.hasNext()){
            Map.Entry<String,Integer> e=it.next();
            String key=e.getKey();
            Integer value=e.getValue();
            System.out.println(key+"====="+value);
        }
    }
}
